//
//  NSString+JSON.m
//  haierapp
//
//  Created by gaotangzhang on 14-8-20.
//  Copyright (c) 2014年 haier. All rights reserved.
//

#import "NSString+JSON.h"

@implementation NSString (JSON)

-(id)toArrayOrDictionary{
    NSError *error=nil;
    
    id jsonObject=[NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:&error];
    
    if (jsonObject!=nil && error==nil) {
        return jsonObject;
    }else{
        //解析出错
        return nil;
    }
    
}

@end
